# -*- coding: UTF-8 -*-

from django.contrib.auth.decorators import login_required

# Create your views here.
from .models import Game
from .forms import Game_Search_Form,Test_Game_Search_Form,GameForm
from .function import Public_GAME_OPERATION,Game_Public,Test_Game_Public
from celery import shared_task

@login_required()
def game_list(request):
    cls = Game_Public()
    return cls.url_get(request, app="game", template="game_list",
                 form=GameForm, models=Game,
                 search_form=Game_Search_Form)


@login_required()
def game_mananger(request):
    cls = Game_Public()
    return cls.url_get(request, app="game", template="game_mananger",
                 form=GameForm, models=Game,
                 search_form=Game_Search_Form)

@login_required()
def test_game_mananger(request):
    cls = Test_Game_Public()
    return cls.url_get(request, app="game", template="test_game_mananger",
                 form=GameForm, models=Game,
                 search_form=Test_Game_Search_Form)



@login_required()
@shared_task(serializer='json')
def game_operation(request):
    cls = Public_GAME_OPERATION()
    return cls.url_get(request)

